﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class mod : System.Web.UI.Page
{

    protected void Button1_Click(object sender, EventArgs e)
    {
        if ( TextBox2.Text.ToString().Trim() == "" || TextBox3.Text.ToString().Trim() == "")
        {
            Response.Write("<script>javascript:alert('请填写完整');history.back();</script>");
        }
        else
        {
            if (TextBox2.Text.ToString().Trim() != TextBox3.Text.ToString().Trim())
            {
                Response.Write("<script>javascript:alert('两次密码不一致，请确认');history.back();</script>");
            }
            else
            {
                string sql;
                sql = "update 管理员 set 姓名='" + this.TextBox2.Text + "' where 密码='" + Session["username"].ToString() + "'";
                Class1 C = new Class1();
                int Ru = C.hsgexucute(sql);
                if (Ru > 0)
                {
                    Response.Write("<script>javascript:alert('修改密码成功！');history.back();</script>");
                }
                else
                {
                    Response.Write("<script>javascript:alert('修改密码失败！');history.back();</script>");

                }
            }
        }
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        Response.Redirect("sy.aspx");
    }
}
